<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文本</title>
<link th:href="@{/css/style.css}" rel="stylesheet" type="text/css" />
<script type="text/javascript" th:src="@{/js/jquery.js}"></script>
<script type="text/javascript">
  function tipOpen(content,num,rstate) {
	$(".tipright p").text(content);
	$("#tip").fadeIn(200);
    $("#rid").val(num);
    $("#rstate").val(rstate);
}
function tipClose() {
	$("#tip").fadeOut(200);
    var rid=$("#rid").val();
    var rstate=$("#rstate").val();
  location.href="/erp1/rep/rkware/updatestate?id="+rid;
}
function goPage(num) {
    $("#pageno").val(num);
    $("#rkwareform").submit();
}

function tipClose2() {
  $("#tip").fadeOut(200);
}

</script>
</head>

<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li>仓库管理</li>
    <li>入库管理</li>
    <li>基本内容</li>
  </ul>
</div>
<div class="rightinfo">
  <form action="/erp1/rep/rkware/allrkware" method="post" id="rkwareform">
    <input type="hidden" name="pageno" id="pageno" value=""/>
    <ul class="tools">
      <li>仓库名称:
        <input type="text" name="wareName2" th:value="${wareName2}" />
      </li>
      <li>采购单编号:
        <input type="text" name="rkIndent" th:value="${rkIndent}" />
      </li>
      <li>状态:
        <select name="state">
        	<option value="">请选择</option>
            <option th:each="m : ${rkmap}" th:value="${m.key}" th:text="${m.value}" th:selected="${state==m.key}"></option>
        </select>
      </li>
      <li class="subBut" onclick="goPage(1)"><img th:src="@{/images/t06.png}" />查询</li>
      <li class="subBut" onclick="window.location.href='/erp1/rep/rkware/doAdd'"><img th:src="@{/images/t01.png}" />添加入库</li>
    </ul>
    <table class="tablelist">
      <thead>
        <tr>
          <th>序号</th>
          <th>采购单编号</th>
          <th>金额</th>
          <th>仓库名称</th>
          <th>入库时间</th>
          <th>入库人</th>
          <th>状态</th>
          <th>操作</th>
        </tr>
      </thead>
      <tbody>
        <tr th:each="r,var : ${rkinfo.list}">
          <td th:text="${var.count+(rkinfo.pageNum-1)*rkinfo.pageSize}"></td>
          <td th:text="${r.rkIndent}"></td>
          <td th:text="${r.cPurchase.totalMoney}"></td>
          <td th:text="${r.warehouse.cName}"></td>
          <td th:text="${#dates.format(r.rkDate,'yyyy-MM-dd')}"></td>
          <td th:text="${r.users.uname}"></td>
          <td th:if="${r.state.equals('1')}">未入库</td>
          <td th:if="${r.state.equals('2')}">已入库</td>
          <td>
          	<a th:href="@{'/rep/rkware/CKdetails/'+${r.id}}" class="tablelink">查看详情</a>
            <input type="hidden" id="rid">
            <input type="hidden" id="rstate">
            <a href="javascript:void(0)" th:if="${r.state.equals('1')}" class="tablelink" th:onclick="@{'tipOpen(\'确定此采购单入库吗？\','+${r.id}+',2)'}">入库</a>
            <a href="javascript:void(0)" th:if="${r.state.equals('2')}" class="tablelink" th:onclick="@{'tipOpen(\'确定此采购单取消入库吗？\','+${r.id}+',1)'}">取消入库</a>
          </td>
        </tr>
      </tbody>
    </table>
    <div class="pagin">
      <div class="message">共<i class="blue" th:text="${rkinfo.total}"></i>条记录，当前显示第&nbsp;<i class="blue"
                                                                                                  th:text="${rkinfo.pageNum+'&nbsp;'}"></i>页
      </div>
      <ul class="paginList">
        <li class="paginItem">
          <a href="javascript:void(0);"
             th:onclick="goPage([[${rkinfo.isFirstPage?1:rkinfo.pageNum-1}]])">
            <span th:class="${rkinfo.isFirstPage?'pagepre':'pagenxt roate'}"></span>
          </a>
        </li>
        <li th:class="${page==rkinfo.pageNum?'paginItem current':'paginItem'}"
            th:each="page : ${rkinfo.navigatepageNums}">
          <a href="javascript:;" th:text="${page}" th:onclick="goPage([[${page}]])"></a>
        </li>
        <li class="paginItem">
          <a href="javascript:void(0);"
             th:onclick="goPage([[${rkinfo.isLastPage?rkinfo.pages:rkinfo.pageNum+1}]])">
            <span th:class="${rkinfo.isLastPage?'pagepre roate':'pagenxt'}"></span>
          </a>
        </li>
      </ul>
    </div>
  </form>
  <!-- 提示框 -->
  <div id="tip" class="tip">
    <div class="tiptop"><span>提示信息</span><a onclick="tipClose2()"></a></div>
    <div class="tipinfo"> <span><img src="../../images/ticon.png" /></span>
      <div class="tipright">
        <p></p>
        <cite>如果是请点击确定按钮 ，否则请点取消。</cite> </div>
    </div>
    <div class="tipbtn">
      <input name="" type="button"  class="sure" value="确定" onclick="tipClose()" />
      &nbsp;
      <input name="" type="button"  class="cancel" value="取消" onclick="tipClose2()" />
    </div>
  </div>
</div>
<script type="text/javascript">
	$('.tablelist tbody tr:odd').addClass('odd');
</script>
</body>
</html>
